<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0, maximum-scale=1.0"
    />

    <title>银河院线- 登录</title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <link href="/admin/css/bootstrap.min.css" rel="stylesheet" />
    <link href="/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet" />
    <link href="/admin/css/animate.css" rel="stylesheet" />
    <link href="/admin/css/style.css" rel="stylesheet" />
    <link href="/admin/css/login.css" rel="stylesheet" />
    <!--[if lt IE 9]>
      <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>
      if (window.top !== window.self) {
        window.top.location = window.location;
      }
    </script>
  </head>

  <body class="signin">
    <div class="signinpanel">
      <div class="row">
        <div class="col-sm-12">
          <!-- <h4 class="no-margins">登录：</h4> -->
          <p class="m-t-md">银河院线-管理系统</p>
          <input
            type="text"
            class="form-control uname"
            placeholder="用户名"
            id="txtUserName"
          />
          <input
            type="password"
            class="form-control pword m-b"
            placeholder="密码"
            id="txtPassword"
          />
          <button onclick="loginHandle()" class="btn btn-success btn-block">
            登录
          </button>
        </div>
      </div>
      <div class="signup-footer">
        <div class="pull-left">
          &copy; 银河院线
        </div>
      </div>
    </div>
    <script src="/admin/js/jquery.min.js"></script>
    <script>
      function loginHandle() {
        var userName = $("#txtUserName").val();
        var password = $("#txtPassword").val();
        if (userName && password) {
          $.post("/api/v1/auth/login_manager", { userName, password }).then(
            (res) => {
              if (res.code == 1) {
                window.location.href = "/admin/main";
              } else {
                alert(res.msg);
              }
            }
          );
        } else {
          alert("请输入用户名和密码");
        }
      }
    </script>
  </body>
</html>
